import javafx.scene.transform.Scale;

import java.util.Scanner;

class Solution1 {
    public int calculateMinimumHP(int[][] dungeon) {
        int n = dungeon.length, m = dungeon[0].length;
        int[][] dp = new int[n + 1][m + 1];
        for(int i = 0; i<=n; i++) {
            dp[i][m] = Integer.MAX_VALUE;
        }
        for(int i = 0; i<=m; i++) {
            dp[n][i] = Integer.MAX_VALUE;
        }
        dp[n][m-1] = 1;
        for(int i = n-1; i>=0; i--) {
            for(int j = m-1; j>=0; j--) {
                dp[i][j] = Math.min(dp[i][j+1],dp[i+1][j]) - dungeon[i][j];
                dp[i][j] = Math.max(1,dp[i][j]);
            }
        }
        return dp[0][0];
    }
}

class Solution2 {
    public int returnToBoundaryCount(int[] nums) {
        int count = 0;
        int sum = 0;
        for(int i= 0; i<nums.length; i++) {
            sum += nums[i];
            if(sum == 0) {
                count++;
            }
        }
        return count;
    }
}

//abacaba
//caba

class Solution3 {
    public int minimumTimeToInitialState(String word, int k) {
        int n = word.length();
        int count = 0;
        int i = 0, j = n-1;
        while(word.charAt(i) == word.charAt(j) && i<j) {
            i++;
            j--;
        }
        //System.out.println(n);
        //System.out.println(i);
        if((n-i)%k == 0) return (n-i)/k==0?1:(n-i)/k;
        return (n-i)/k+1;
    }
}

class Solution4 {
    public int massage(int[] nums) {
        int n = nums.length;
        int[] g = new int[n]; //选第i个位置
        int[] f = new int[n]; //不选第i个位置
        g[0] = nums[0];
        f[0] = 0;
        for(int i = 1; i<n; i++) {
            g[i] = f[i-1] + nums[i];
            f[i] = Math.max(f[i-1],g[i-1]);
        }
        return Math.max(g[n-1],f[n-1]);
    }
}

class Solution5 {
    public int rob(int[] nums) {
        int n = nums.length;
        int[] f = new int[n]; //不选第i个位置
        int[] g = new int[n]; //选第i个位置
        //1.选第一个位置
        g[2] = nums[2];
        for(int i = 3; i<n-1; i++) {
            f[i] = Math.max(f[i-1],g[i-1]);
            g[i] = f[i-1] + nums[i];
        }

        //2.不选第一个位置
        int[] f1 = new int[n]; //不选第i个位置
        int[] g1 = new int[n]; //选第i个位置
        g1[1] = nums[1];
        for(int i = 2; i<n; i++) {
            f1[i] = Math.max(f1[i-1],g1[i-1]);
            g1[i-1] = f1[i-1] + nums[i];
        }

        return Math.max(nums[0] + Math.max(f[n-2],g[n-2]), Math.max(f1[n-1],g1[n-1]));
    }
}

class Solution {
    public int rob(int[] nums) {
        int n = nums.length;
        return Math.max(nums[0] + rob1(nums,2,n-2), rob1(nums,1,n-1));
    }
    public int rob1(int[] nums, int left, int right) {
        if(left > right) return 0;
        int n = nums.length;
        int[] f = new int[n];
        int[] g = new int[n];
        f[left] = nums[left];
        for(int i = left + 1; i<=right; i++) {
            f[i] = g[i-1] + nums[i];
            g[i] = Math.max(g[i-1], f[i-1]);
        }
        return Math.max(f[right], g[right]);
        Math.pow();
    }
}

public class Main {
    public static void main(String[] args) {
        int ret = new Solution3().minimumTimeToInitialState("abacaba",3);
        System.out.println(ret);
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int count = 0;
        int k = nums[0] % 10;
        for (int i = 0; i < n - 1; i++) {
            int last = nums[i] % 10;
            int pre = String.valueOf(nums[i + 1]).charAt(0) - '0';
            if (last != pre) count++;
        }
        System.out.println(count);
    }
}
